const { ipcRenderer } = require("electron");

window.addEventListener("DOMContentLoaded", () => {
  const [ aBtn, bBtn ] = document.querySelectorAll("button");
  aBtn.addEventListener("click", () => {
    ipcRenderer.send("msg", "来自渲染进程的异步信息");
  });
  bBtn.addEventListener("click", () => {
    let replyData =  ipcRenderer.sendSync("msg2", "来自渲染进程的同步信息");
    console.log(replyData);
  });

  ipcRenderer.on("msgReply", (ev, data) => {
    console.log(data);
  });

  ipcRenderer.on("mtp", (event, data) => {
    console.log(data);
  });
});